package com.zkthink.ceres.promotion.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.zkthink.base.entity.Entity;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;
import java.time.LocalDateTime;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.zkthink.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 
 * </p>
 *
 * @author JustArgo
 * @since 2020-06-26
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("ceres_coupon")
@ApiModel(value = "Coupon", description = "")
@AllArgsConstructor
public class Coupon extends Entity<Long> {

    private static final long serialVersionUID = 1L;

    /**
     * 1-活动优惠券
     */
    @ApiModelProperty(value = "1-活动优惠券")
    @NotNull(message = "1-活动优惠券不能为空")
    @TableField("biz_type")
    @Excel(name = "1-活动优惠券")
    private Integer bizType;

    /**
     * 满X，单位(分)
     */
    @ApiModelProperty(value = "满X，单位(分)")
    @NotNull(message = "满X，单位(分)不能为空")
    @TableField("full_amount")
    @Excel(name = "满X，单位(分)")
    private Long fullAmount;

    /**
     * 减Y，单位(分)
     */
    @ApiModelProperty(value = "减Y，单位(分)")
    @NotNull(message = "减Y，单位(分)不能为空")
    @TableField("discount_amount")
    @Excel(name = "减Y，单位(分)")
    private Long discountAmount;

    /**
     * 业务id, 根据biz_type不同设置不同的值
     */
    @ApiModelProperty(value = "业务id, 根据biz_type不同设置不同的值")
    @NotEmpty(message = "业务id, 根据biz_type不同设置不同的值不能为空")
    @Length(max = 64, message = "业务id, 根据biz_type不同设置不同的值长度不能超过64")
    @TableField(value = "biz_id", condition = LIKE)
    @Excel(name = "业务id, 根据biz_type不同设置不同的值")
    private String bizId;

    /**
     * 优惠券发行开始时间，发行之后即可领取，但是尚不能使用
     */
    @ApiModelProperty(value = "优惠券发行开始时间，发行之后即可领取，但是尚不能使用")
    @NotNull(message = "优惠券发行开始时间，发行之后即可领取，但是尚不能使用不能为空")
    @TableField("publish_start_time")
    @Excel(name = "优惠券发行开始时间，发行之后即可领取，但是尚不能使用", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime publishStartTime;

    /**
     * 优惠券发行结束时间
     */
    @ApiModelProperty(value = "优惠券发行结束时间")
    @NotNull(message = "优惠券发行结束时间不能为空")
    @TableField("publish_end_time")
    @Excel(name = "优惠券发行结束时间", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime publishEndTime;

    /**
     * 优惠券使用开始时间
     */
    @ApiModelProperty(value = "优惠券使用开始时间")
    @NotNull(message = "优惠券使用开始时间不能为空")
    @TableField("use_start_time")
    @Excel(name = "优惠券使用开始时间", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime useStartTime;

    /**
     * 优惠券使用结束时间
     */
    @ApiModelProperty(value = "优惠券使用结束时间")
    @NotNull(message = "优惠券使用结束时间不能为空")
    @TableField("use_end_time")
    @Excel(name = "优惠券使用结束时间", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime useEndTime;

    /**
     * 是否删除 1-删除 0-未删除
     */
    @ApiModelProperty(value = "是否删除 1-删除 0-未删除")
    @NotNull(message = "是否删除 1-删除 0-未删除不能为空")
    @TableField("is_delete")
    @Excel(name = "是否删除 1-删除 0-未删除")
    private Integer isDelete;


    @Builder
    public Coupon(Long id, Long createUser, LocalDateTime createTime, Long updateUser, LocalDateTime updateTime, 
                    Integer bizType, Long fullAmount, Long discountAmount, String bizId, LocalDateTime publishStartTime,
                    LocalDateTime publishEndTime, LocalDateTime useStartTime, LocalDateTime useEndTime, Integer isDelete) {
        this.id = id;
        this.createUser = createUser;
        this.createTime = createTime;
        this.updateUser = updateUser;
        this.updateTime = updateTime;
        this.bizType = bizType;
        this.fullAmount = fullAmount;
        this.discountAmount = discountAmount;
        this.bizId = bizId;
        this.publishStartTime = publishStartTime;
        this.publishEndTime = publishEndTime;
        this.useStartTime = useStartTime;
        this.useEndTime = useEndTime;
        this.isDelete = isDelete;
    }

}
